<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .outer{
            width: 300px;
            height: 300px;
            background-color: red;
        }
        .center{
            width: 200px;
            height: 200px;
            background-color: blue;
        }
        .inner{
            width: 100px;
            height: 100px;
            background-color: yellow;
        }
    </style>
</head>
<body>
    <div class="outer">
        <div class="center">
            <div class="inner"></div>
        </div>
    </div>
    <script>
        // 绑定事件
        var outer = document.querySelector('.outer')
        var center = document.querySelector('.center')
        var inner = document.querySelector('.inner')
        outer.onclick = function(){
            console.log('我是outer')
        }
        center.onclick = function(e){
            // 阻止事件传播  e.stopPropagation()
            e.stopPropagation()
            console.log('我是center')
        }
        inner.onclick = function(e){
            e.stopPropagation()
            console.log('我是inner')
        }
    </script>
</body>
</html>